package com.copa.module.user.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.copa.annotation.Log;
import com.copa.domain.PageVo;
import com.copa.domain.ResponseDto;
import com.copa.module.user.domain.entity.UserEntity;
import com.copa.module.user.domain.vo.UserListVo;
import com.copa.module.user.domain.vo.UserUpdateVo;
import com.copa.module.user.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author copa
 * @createDate 2021-01-04 21:53
 * @function
 */
@RestController
@Api(tags = {"用户操作接口"})
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/user/list")
    @ApiOperation(value = "查询所有用户")
    public ResponseDto<IPage<UserEntity>> list(@RequestBody UserListVo userListVo) {
        return userService.list(userListVo);
    }

    @Log("修改用户是否可用")
    @PostMapping("/user/updateIsEnable")
    @ApiOperation(value = "修改用户是否可用")
    public ResponseDto<String> updateIsEnable(@RequestBody UserUpdateVo userUpdateVo) {
        return userService.updateIsEnable(userUpdateVo);
    }
}
